import java.util.HashSet;
import java.util.Objects;
class MyDate{
    private String year;
    private String Month;
    private String Day;

    public MyDate(String year, String month, String day) {
        this.year = year;
        Month = month;
        Day = day;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public String getMonth() {
        return Month;
    }

    public void setMonth(String month) {
        Month = month;
    }

    public String getDay() {
        return Day;
    }

    public void setDay(String day) {
        Day = day;
    }
}
class Worker extends MyDate{
    private String name;
    private int age;
    private String year;
    private String Month;
    private String Day;

    public Worker(String year, String month, String day, String name, int age, String year1, String month1, String day1) {
        super(year, month, day);
        this.name = name;
        this.age = age;
        this.year = year1;
        Month = month1;
        Day = day1;
    }

    @Override
    public String toString() {
        return "Worker{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", year='" + year + '\'' +
                ", Month='" + Month + '\'' +
                ", Day='" + Day + '\'' +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Worker worker = (Worker) o;
        return age == worker.age && Objects.equals(name, worker.name) && Objects.equals(year, worker.year) && Objects.equals(Month, worker.Month) && Objects.equals(Day, worker.Day);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age, year, Month, Day);
    }
}
public class Main {
    public static void main(String[] args) {
        HashSet hashSet=new HashSet<>();
        hashSet.add(new Worker("2022","2","23","xx",12,"2022","2","23"));
        hashSet.add(new Worker("2022","2","23","xx",12,"2022","2","23"));
        System.out.println(hashSet);
    }
}